import com.yenchingcheng.entity.Employee;

/**
 * @Author Yenchingcheng
 * @Date 2023/7/31 15:58
 * @Description 测试类
 **/
public class Test {

    /**测试结果--组合模式：打印出员工的树形层次结构
     * Employee{name='Amy', dept='CEO', salary=50000'}
     * Employee{name='Bruce', dept='headSales', salary=20000'}
     * Employee{name='David', dept='Sales', salary=10000'}
     * Employee{name='Edison', dept='Sales', salary=10000'}
     * Employee{name='Cindy', dept='headMarketing', salary=20000'}
     * Employee{name='Franklin', dept='Marketing', salary=10000'}
     * Employee{name='Gordon', dept='Marketing', salary=10000'}
     */
    public static void main(String[] args) {
        Employee CEO = new Employee("Amy","CEO",50000);

        Employee headSales = new Employee("Bruce","headSales",20000);
        Employee headMarketing = new Employee("Cindy","headMarketing",20000);

        Employee clerk1 = new Employee("David","Sales",10000);
        Employee clerk2 = new Employee("Edison","Sales",10000);

        Employee clerk3 = new Employee("Franklin","Marketing",10000);
        Employee clerk4 = new Employee("Gordon","Marketing",10000);

        CEO.add(headSales);
        CEO.add(headMarketing);

        headSales.add(clerk1);
        headSales.add(clerk2);

        headMarketing.add(clerk3);
        headMarketing.add(clerk4);

        System.out.println(CEO);
        for (Employee employee :CEO.getEmployeeList()) {
            System.out.println(employee);
            for (Employee employee1 :employee.getEmployeeList()) {
                System.out.println(employee1);
            }
        }
    }
}
